package com.neusoft.tijian.controller;

import com.neusoft.tijian.po.OverallResult;
import com.neusoft.tijian.service.OverallResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/overallResult")
public class OverallResultController {

    @Autowired
    private OverallResultService overallResultService;

    // 查询总检结论
    @PostMapping("/listOverallResultByOrderId")
    public List<OverallResult> listOverallResultByOrderId(@RequestBody Map<String, Integer> params) {
        return overallResultService.listOverallResultByOrderId(params.get("orderId"));
    }

    // 新增总检结论
    @PostMapping("/saveOverallResult")
    public Integer saveOverallResult(@RequestBody OverallResult overallResult) {
        return overallResultService.saveOverallResult(overallResult);
    }

    // 更新总检结论
    @PostMapping("/updateOverallResult")
    public Integer updateOverallResult(@RequestBody OverallResult overallResult) {
        return overallResultService.updateOverallResult(overallResult);
    }

    // 删除总检结论
    @PostMapping("/removeOverallResult")
    public Integer removeOverallResult(@RequestBody Map<String, Integer> params) {
        return overallResultService.deleteOverallResult(params.get("orId"));
    }
}